<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>订单管理 - {$site_name}</title>
	<meta name="keywords" content="{$site_seo_keywords}" />
	<meta name="description" content="{$site_seo_description}">
	<tc_include file="Public:head" />	
</head>

<body class="body-white" id="top">
	<!---头部开始--->
	<tc_include file="Public:header"/>
	<!---头部结束--->

		<div class="k-row user-center-main">
                <div class="row">
                    <div class="c-left fl">
	                    <tc_include file="Public:usernav"/>
                    </div>
                    <div class="c-right fr">
                           <div class="tabs">
                               <ul class="nav nav-tabs">
                                   <li class="active">全部订单</li>                                   
                               </ul>
							   <div class="clear"></div>
                               <div class="tab-content" style="padding-right:26px;padding-left:26px;">
                                   <div class="tab-pane active">
                                   		<form class="form-horizontal js-ajax-form" action="{:U('profile/edit_post')}" method="post">
                                   			<div class="c-order">
												<table>
													<tr class="top-tr">
														<th>订单详细</th>
														<th width=100>收货人</th>
														<th width=100>金额</th>
														<th width=100>订单状态</th>
														<th width=100>操作</th>
													</tr>
													<foreach name="order" item="vo">
													
													<tr height=20>
														<td colspan=5></td>
													</tr>
													<tr class="tr-th">
														<td colspan=5 class=""><span class="add-time">下单日期：{$vo.add_time|date="Y-m-d H:i:s",###}</span><span class="num">订单号：{$vo.order_sn}</span></td>
													</tr>
													
													<tr class="tr-bd">
														<td class="g-td">
														<foreach name="vo.goods_list" item="val">
														
														<div class="goods-item">
															<a href="{:U('Goods/article/index',array('g_id'=>$val['goods_id']))}" target="_blank"><img class="g-img fl" src="{:sp_get_asset_upload_path($val['goods_img'])}" alt="{$val.goods_name}" title="{$val.goods_name}" /></a>
															<div class="t-goods fl">
																<a href="{:U('Goods/article/index',array('g_id'=>$val['goods_id']))}" title="{$val.goods_name}" target="_blank">{$val.goods_name|msubstr=0,20,'utf-8','...'}</a><br />
																<span>{$val.spec_item_name}</span>
															</div>															
															<span class="fl g-num">x{$val.goods_num}</span>
														</div>
														<div class="clear"></div>
														<div class="spr"></div>
														</foreach>
														
														</td>
														<td align="center">{$vo.consignee}</td>
														<td align="center">￥{$vo.order_amount}</td>
														<td align="center">
														<p>
														<if condition="($vo.shipping_status eq 2) AND ($vo.order_status eq 1)">
														<p>已收货</p>
														<elseif condition="$vo.order_status eq 2" />
														<span class="fh">已完成</span>
														<else />
														<if condition="$vo.order_status eq 4">
														{$order_status[$vo[order_status]]}
														<elseif condition="($vo.pay_status eq 0) AND ($vo.order_status neq 4)" />
														{$pay_status[$vo[pay_status]]}
														<elseif condition="($vo.pay_status eq 3) AND ($vo.order_status neq 4)" />
														{$pay_status[$vo[pay_status]]}														
														<elseif condition="($vo.pay_status eq 1) AND ($vo.order_status neq 4)" />
														{$pay_status[$vo[pay_status]]}															
														</if>
														</p>
														<p>
														<if condition="($vo.shipping_status eq 0) AND ($vo.pay_status neq 0)">
														未发货
														<elseif condition="$vo.shipping_status eq 1" />
														已发货
														</if>
														</p>
														</if>
														</td>
														<td align="center">
															<a href="{:U('User/profile/order_detail',array('order_id'=>$vo[order_id]))}" class="r-order">查看订单</a>
															<if condition="($vo.pay_status eq 0) AND ($vo.order_status neq 4)">
															<a href="{:U('Goods/cart/topay',array('order_id'=>$vo['order_id']))}" class="btn btn-on">付款</a>
															<elseif condition="($vo.shipping_status eq 1) AND ($vo.order_status neq 4)" />
															<a href="javascript:;" class="btn btn-on" onclick="layerPrompt('{$vo['order_id']}','receive')">确定收货</a>
															<elseif condition="($vo.shipping_status eq 2) AND ($vo.order_status eq 1)" />
															<a href="{:U('Comment/GoodsComment/index',array('order_id'=>$vo['order_id']))}" class="btn btn-on">评价</a>
															<elseif condition="$vo.order_status eq 4" />
															<span class="xh">订单无效</span>															
															</if>
															<if condition="($vo.pay_status eq 0) AND ($vo.order_status eq 0)">
															<a href="javascript:;" class="r-order" onclick="layerPrompt('{$vo['order_id']}','invalid')">取消订单</a>
															</if>
															
														</td>
													</tr>
													
													</foreach>
												</table>
											</div>
                                   		</form>
										<div class="pagination">{$page}</div>
										<div class="clear"></div>
                                   </div>
								   
                               </div>							
                           </div>
						   
                    </div>
                </div>
		</div>
		<tc_include file="Public:footer" />

	
	<!-- /container -->

	<tc_include file="Public:scripts" />
	<script type="text/javascript">
	$(function(){
		$(".nav-tabs li:first").addClass('active');
		 $(".nav-tabs li").click(function(){
			 $(this).addClass("active").siblings().removeClass("active"); 
			 var index=$(this).index(); 
			 $(".tab-content > .tab-pane").eq(index).show().siblings().hide(); 
		 });
	});
	</script>	
	<script type="text/javascript">
	function layerPrompt(id,type){		
		layer.confirm('确定要进行此操作吗？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			operate(id,type);
			layer.closeAll('page');
			layer.msg(null);
		}, function(){
		  
		});
	}
	</script>
	<script type="text/javascript">
		function operate(id,type){
			$.ajax({
				url:"/index.php?g=User&m=profile&a=operate&type="+type+"&id="+id,
				success: function(data){					
					parent.location.reload();
				}
			});	
		}
	</script>
</body>
</html>